/*
package cn.school.web;

import cn.school.entity.Grade;
import cn.school.entity.Page2;
import cn.school.service.GradeService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "GradeServlet",value = "/gradeServlet",initParams = {@WebInitParam(name = "encoding",value = "utf-8")})

public class GradeServlet extends HttpServlet {
    String encoding;
    GradeService g=new GradeService();
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

       String ip=request.getRemoteHost();
      */
/* if(ip.equals("192.168.1.45")){
           response.getWriter().print("服务器正在维护中");
           return;
       }*//*

        System.out.println("获得参数："+encoding);
        //List<Grade> grades = g.findALL();
        //request.setAttribute("grades",grades);
        int pageNo=1;
        try {
            pageNo = Integer.parseInt(request.getParameter("pageNo"));
        }catch(Exception e){}

        Page2<Grade> search = g.search(pageNo);
        request.setAttribute("grades",search);

//        List<Grade> search = g.search(pageNo);
//        int total=g.searchTotal();
//        request.setAttribute("grades",search);
//        request.setAttribute("total",total);
//        request.setAttribute("pageNo",pageNo);
        request.getRequestDispatcher("grade.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request,response);
    }

    @Override
    public void init() throws ServletException {
        encoding=super.getServletConfig().getInitParameter("encoding");
    }


}
*/
